
import request from '@/utils/request'

// 文章列表
export function list(params) {
  return request({
    url: '/articles',
    method: 'get',
    params
  })
}

// 文章简单列表
export function simple(data) {
  return request({
    url: '/articles/simple',
    method: 'get',
    data
  })
}

// 文章详情
export function detail(data) {
  return request({
    url: `/articles/${data.id}`,
    data: {
      id: data.id
    },
    method: 'get'
  })
}

// 文章添加
export function add(data) {
  return request({
    url: '/articles',
    method: 'post',
    data
  })
}

// 文章修改
export function update(data) {
  return request({
    url: `/articles/${data.id}`,
    method: 'put',
    data
  })
}

// 文章删除
export function remove(data) {
  return request({
    url: `/articles/${data.id}`,
    method: 'delete',
    data
  })
}

// 文章状态
export function changeState(data) {
  return request({
    url: `/articles/${data.id}/${data.state}`,
    method: 'post',
    data: {
      id: data.id,
      state: data.state
    }
  })
}

